package com.qtt.app.mapper;

import com.qtt.app.entity.AppConcern;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AppConcernMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(AppConcern record);

    int insertSelective(AppConcern record);

    AppConcern selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(AppConcern record);

    int updateByPrimaryKey(AppConcern record);

    List<AppConcern> getConcernTeachers(@Param("user_id") Long userId, @Param("concern_state") Integer concernState, @Param("flag") Integer flag);

    List<AppConcern>getConcernInstitutions(@Param("user_id") Long userId,@Param("concern_state") Integer concernState,@Param("flag") Integer flag);

    List<AppConcern> getMyConcernCourses(@Param("user_id") Long userId,@Param("concernState") Integer concernState,@Param("flag") Integer flag);

    List<AppConcern> getMyConcern(@Param("userId") Long userId,@Param("concernState") Integer concernState,@Param("flag") Integer flag);

    AppConcern getConcernInstByFlagAndUserid(@Param("flag") Integer flag,@Param("userId") Long userId,@Param("concernId") String concernId);

    int addConcernInstitution(@Param("appConcern") AppConcern appConcern);

    @Select("SELECT concern_state FROM app_concern WHERE user_id=#{userId} AND flag=#{flag} AND concern_id=#{concernId}")
    Integer isMyConcern(@Param("userId") Long userId,@Param("flag") Integer flag,@Param("concernId") String concernId);
}